package org.nekperu15739.aboutme.persistencemodel.domain.abstracts;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.nekperu15739.aboutme.persistencemodel.domain.interfaces.Entity;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.jpa.domain.AbstractAuditable;

import java.io.Serializable;


@MappedSuperclass
public abstract class EntityAbstract<U, ID extends Serializable> extends AbstractAuditable<U, ID> implements Entity<ID> {
	
	private static final long serialVersionUID = 1L;

	protected String audUser;
	protected Date audTime;

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	@CreatedBy
	public String getAudUser() {
		return audUser;
	}

	public void setAudUser(String audUser) {
		this.audUser = audUser;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "audTime")
	public Date getAudTime() {
		return audTime;
	}

	public void setAudTime(Timestamp audTime) {
		this.audTime = audTime;
	}

}
